package com.quasar.hpatient.bean.home_assay_single;

import android.text.TextUtils;

import lib.quasar.context.BaseConstant;
import lib.quasar.util.LogUtil;
import lib.quasar.widget.chart.entry.Entry;

public class SingleItemBean implements Entry {

    private String uuid = BaseConstant.NULL_STR;
    private int sortid;
    private long patientid;
    private int itemid;
    private String param_value = BaseConstant.NULL_STR;
    private String standard_value = BaseConstant.NULL_STR;

    private String item_value = BaseConstant.NULL_STR;
    private String item_name = BaseConstant.NULL_STR;
    private String inspection_name = BaseConstant.NULL_STR;
    private String inspection_date = BaseConstant.NULL_STR;
    private String indexid = BaseConstant.NULL_STR;
    private int id;
    private int groupid;
    private int flag;
    private String dose_name = BaseConstant.NULL_STR;
    private String critical_value = BaseConstant.NULL_STR;
    private String boundary_value = BaseConstant.NULL_STR;
    private int belongto;
    private int attribute;

    public int getBelongto() {
        return belongto;
    }

    public void setBelongto(int belongto) {
        this.belongto = belongto;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Object getUuid() {
        return uuid;
    }

    /*******************************************************************/

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public long getPatientid() {
        return patientid;
    }

    public void setPatientid(long patientid) {
        this.patientid = patientid;
    }

    public String getInspectiondate() {
        return inspection_date;
    }

    public void setInspectiondate(String inspectiondate) {
        this.inspection_date = inspectiondate;
    }

    public Object getIndexid() {
        return indexid;
    }

    public void setIndexid(String indexid) {
        this.indexid = indexid;
    }

    public String getInspectionname() {
        return inspection_name;
    }

    public void setInspectionname(String inspectionname) {
        this.inspection_name = inspectionname;
    }

    public String getItemname() {
        return item_name;
    }

    public void setItemname(String itemname) {
        this.item_name = itemname;
    }

    public String getDosename() {
        return dose_name;
    }

    public void setDosename(String dosename) {
        this.dose_name = dosename;
    }

    public String getItemvalue() {
        return item_value;
    }

    public void setItemvalue(String itemvalue) {
        this.item_value = itemvalue;
    }

    public int getGroupid() {
        return groupid;
    }

    public void setGroupid(int groupid) {
        this.groupid = groupid;
    }

    public int getItemid() {
        return itemid;
    }

    public void setItemid(int itemid) {
        this.itemid = itemid;
    }

    public int getSortid() {
        return sortid;
    }

    public void setSortid(int sortid) {
        this.sortid = sortid;
    }

    public String getParamvalue() {
        return param_value;
    }

    public void setParamvalue(String paramvalue) {
        this.param_value = paramvalue;
    }

    public String getStandardvalue() {
        return standard_value;
    }

    public void setStandardvalue(String standardvalue) {
        this.standard_value = standardvalue;
    }

    public String getCriticalvalue() {
        return critical_value;
    }

    public void setCriticalvalue(String criticalvalue) {
        this.critical_value = criticalvalue;
    }

    public String getBoundaryvalue() {
        return boundary_value;
    }

    public void setBoundaryvalue(String boundaryvalue) {
        this.boundary_value = boundaryvalue;
    }

    public int getAttribute() {
        return attribute;
    }

    public void setAttribute(int attribute) {
        this.attribute = attribute;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }

    /*******************************************************************/

    @Override
    public float getValue() {

        if (TextUtils.isEmpty(item_value)) {
            return 0f;
        } else {
            return Float.parseFloat(item_value);
        }
    }

    @Override
    public float[] getValues() {
        return null;
    }

    @Override
    public String getAxisX() {
        return inspection_date.substring(5, 10);
    }

    @Override
    public float getAxisYMax() {
        if (TextUtils.isEmpty(boundary_value)) {
            return 300f;
        } else {
            try {
                String[] split = boundary_value.split(BaseConstant.RUNG);
                return Float.parseFloat(split[1]);
            } catch (Exception e) {
                e.printStackTrace();
                return 300f;
            }
        }
    }

    @Override
    public float getAxisYMin() {
        if (TextUtils.isEmpty(boundary_value)) {
            return 30f;
        } else {
            try {
                String[] split = boundary_value.split(BaseConstant.RUNG);
                return Float.parseFloat(split[0]);
            } catch (Exception e) {
                e.printStackTrace();
                return 30f;
            }
        }
    }

    @Override
    public String getUnit() {
        return dose_name;
    }

    @Override
    public String getDate() {
        try {
            final int length = inspection_date.length();
            return inspection_date.substring(length - 8, length - 3);
        } catch (Exception e) {
            LogUtil.e("", e.getMessage(), e);
            return "未知时间";
        }
    }

    @Override
    public String getName() {
        return null;
    }
}
